﻿// ***********************************************************************
// Assembly         : MVC4Portal
// Author           : LJO+01 (Laurent Jordi)
// Created          : 06-05-2013
// Last Modified By : LJO+01 (Laurent Jordi)
// Last Modified On : 06-05-2013
// ***********************************************************************
// <copyright file="FinderController.cs" company="Copyright © Innovacall 2011">
//     Copyright (c) Copyright © Innovacall 2011. All rights reserved.
// </copyright>
// <summary></summary>
// ***********************************************************************
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Security;
using InnovaApp.Layers.CommonLayer.Controllers.ViewControllers;
using InnovaApp.Layers.DataLayer;
using InnovaApp.Layers.ResourcesLayer.Properties;
using InnovaApp.Portals.MVC4Portal.Models;
using InnovaApp.Portals.MVC4Portal.Models.ViewModels.LayoutViewModels;
using INNOVACALL.Framework.Common.MVCHelpers;

namespace InnovaApp.Portals.MVC4Portal.Controllers.ViewControllers.LayoutViewControllers
{
    /// <summary>
    /// Class FinderController
    /// </summary>
    public class FinderController : _LayoutViewControllers_Base<FinderViewModel>
    {
        /// <summary>
        /// Initializes data that might not be available when the constructor is called.
        /// </summary>
        /// <param name="requestContext">The HTTP context and route data.</param>
        protected override void Initialize(System.Web.Routing.RequestContext requestContext)
        {
            base.eMethodBase = "InnovaApp.Portals.InnovaAppFrontOfficePortal.Controllers.FinderController";
            base.specificCssCollection = new string[] { "ClientComponents/ElFinder/css/elfinder.min.css", "ClientComponents/ElFinder/css/theme.css", "Views/Finder.css" };
            base.specificJSCollection = new string[] { "ClientComponents/ElFinder/js/elfinder.min.js", "ClientComponents/tiny_mce/tiny_mce_popup.js" };
            base.dynamicJSCollection = new string[] { "/ScriptsG/FinderDynamic.js" };
            base.specificJqueryJSCollection = new string[] { "Views/Finder.js" };
            base.externalCss = null;

            base.Initialize(requestContext);
        }

        /// <summary>
        /// Indexes this instance.
        /// </summary>
        /// <returns>ActionResult.</returns>
        [HttpGet, Authorize, CacheManager(enCacheMode.NoCache)]
        public ActionResult Index(string language)
        {
            base.LocalizeDynamicScript(language, (CurrentContact != null ? CurrentContact.FavoriteLanguage.Language : null));

            using (DataRepositories _dataContext = new DataRepositories())
            {
                base.InitView(
                    pageTitle: Resources.View_Finder_PageTitle,
                    openingMessage: string.Empty,
                    specificCssCollection: specificCssCollection,
                    specificJSCollection: specificJSCollection,
                    dynamicJSCollection : dynamicJSCollection,
                    specificJqueryJSCollection : specificJqueryJSCollection,
                    jsVariables : jsVariables, 
                    externalJs: externalJs,
                    externalCss: externalCss,
                    metaToAdd: Meta,
                    _dataContext: _dataContext,
                    displayMenus: true,
                    language: language,
                    adminMode: false,
                    usesKendoUI: true,
                    jQueryUITheme: PortalEnvironment.JQueryUITheme,
                    kendoUITheme: PortalEnvironment.KendoUITheme,
                    currentUser: Membership.GetUser()
                    );
            }

            return View(ContentData);
        }

    }
}
